package ControlLayer;
import ModelLayer.*;

/**
 * Write a description of class CustomerCtr here.
 * 
 * @author (Gruppe 2) 
 * @version (a version number or a date)
 */
public class CustomerCtr
{
    private CustomerCon customerCon;

    public CustomerCtr()
    {
        customerCon = customerCon.getInstance();
    }

    // Create new customer
    public void createCustomer(int id, String name, String address, String phone, String mail, String CPRnr)
    {
        if(customerCon.getCustomer(id) == null)
        {
            Customer newCustomer = new Customer(id, name, address, phone, mail, CPRnr);
            customerCon.addCustomer(newCustomer);
        }
        else
        {
            System.out.println("There already exists a customer with id: "+id+" in the system");
        }
    }
    
    // Create new business customer
    public void createBusiness(int id, String name, String address, String phone, String mail, String companyName, String CVRnr, double discount)
    {
        if(customerCon.getBusiness(id) == null)
        {
            BusinessCustomer newBusiness = new BusinessCustomer(id, name, address, phone, mail, companyName, CVRnr, discount);
            customerCon.addBusiness(newBusiness);
        }
        else
        {
            System.out.println("There already exists a business customer with id: "+id+" in the system");
        }
    }
    
    public Customer getCustomer(int id)
    {
        return customerCon.getCustomer(id);
    }
    
    public BusinessCustomer getBusinessCustomer(int id)
    {
        return customerCon.getBusiness(id);
    }
    
    public void printCustomer(int id)
    {
        customerCon.printCustomer(id);
    }
    
    public void printBusiness(int id)
    {
        customerCon.printBusiness(id);
    }
    
    public void printCustomerList()
    {
        customerCon.printCustomerList();
    }
    
    public void printBusinessList()
    {
        customerCon.printBusinessList();
    }
    
    public void removeCustomer(int id)
    {
        customerCon.removeCustomer(id);
    }
    
    public void removeBusiness(int id)
    {
        customerCon.removeBusinessCustomer(id);
    }
}
